class Solution {//leetcode77——组合
private:
    void dfs(int n,int k,int num){
        if(path.size()==k){
            ret.push_back(path);
            return ;
        }
        if(num>n) return;
        for(int i=num;i<=n;i++){
            path.push_back(i);
            dfs(n,k,i+1);
            path.pop_back();
        }
    }
public:
    vector<vector<int>> combine(int n, int k) {
        dfs(n,k,1);
        return ret;
    }
private:
    vector<vector<int>> ret;
    vector<int> path;
};